
#pragma once

#include "ql.h"

typedef struct IdArr
{
    struct IdArr *  next;
    size_t          size;
    Id              arr[1];
} IdArr;

typedef struct LitArr
{
    struct LitArr * next;
    size_t          size;
    char            buffer[1];
} LitArr;

typedef struct SortedIdsArr
{
    Id **           arr;
    size_t          size;
    size_t          allocated;
} SortedIdsArr;




typedef struct IdsStorage
{
    /*
     * used to allocate identifiers
     */
    IdArr *         id_arr;

    /*
     * lookup table
     */
    SortedIdsArr    sorted_ids;

    /*
     * used to allocate string buffers for identifiers
     */
    LitArr *        lit_arr;
} IdsStorage;
